home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / TinyGL / ami / content / ad709 / tinygl / docs / tinygl_asm.txt < prev   
Encoding:
Text File  |  2002-08-15  |  1.5 KB  |  52 lines

  1. Using TinyGL in VP asm code
  2. ======================================
  3.  
  4.  
  5. TinyGL can be used in VP programs by calling it's shared libraries. Two qcallable 
  6. tools are provided to this purpose:
  7.  
  8. ami/lib/ad709/tinygl/init
  9.     provides a link into the library's functions for future use
  10.  
  11. inputs
  12.     - i: specifies which library to link to (options: GL_LIB, GLUT_LIB, GLU_LIB)
  13. outputs
  14.     - p: pointer to the library's function address table (NULL if error)
  15.     - p: pointer to the library's handle (NULL if error)
  16.  
  17.  
  18.  
  19. ami/lib/ad709/tinygl/deinit 
  20.     frees up resources used by the library binding
  21.  
  22. inputs
  23.     - p: pointer to the library's function address table
  24.     - p: pointer to the library's handle 
  25.  
  26.  
  27. Once the function table pointers have been obtained, these should be copied into
  28. a global variable. Some macros are already defined in 'gl.inc' to facilitate this.
  29. The GL, GLUT and GLU macros, can hold the address of the function tables.
  30.  
  31. For example
  32.  
  33. cpy.p p0, GL
  34. cpy.p p1, GLUT
  35.  
  36. where p0 and p1 are pointers to the gl and glut function tables obtained by the 
  37. 'ami/lib/ad709/tinygl/init' tool.
  38.  
  39. GL and GLUT can now be used as pointers to the libraries' function tables. 
  40. To call specific API functions, the function's address must be obtained, using
  41. the API macros:
  42.  
  43. glFoo(GL) 
  44. returns a pointer to the "glFoo" function (sub-routine) in the GL API
  45.  
  46. glutBar(GLUT)
  47. returns a pointer to the "glutBar" function (sub-routine) in the GLUT API
  48.  
  49. Finally, the functions are called using "gos". Example:
  50.  
  51. gos glClear(GL), (GL_COLOR_BUFFER_BIT : -)
  52.